﻿using System;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using K9Nano.IM.Models;

namespace K9Nano.IM.ViewModels
{
    public abstract class AppMd5BaseVM : Md5BaseVM
    {
        [Display(Name = "AppID")]
        [Required(AllowEmptyStrings = false)]
        public Guid AppId { get; set; }

        protected override string GetSecret()
        {
            var app = DC.Set<ChatApp>().FirstOrDefault(x => x.ID == AppId);
            return app?.Secret;
        }
    }
}